[#include "../common/taglibs.html"/]
<div class="modal-header">
	<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
	<h4 class="modal-title">[@spring.message code="user.create.title"/]</h4>
</div>

<div class="modal-control">
	[@form.form commandName="createDTO" method="POST" class="form-horizontal"]
	<input type="hidden" name="format" value="json">
	<div class="modal-body">
		<div class="form-body">
			<div class="form-group">
				<label class="col-md-3 control-label">[@spring.message code="user.create.form.label.userName"/]</label>
				<div class="col-md-9">
					<div class="input-icon">
						<i class="fa fa-user fa-fw"></i>
						[@spring.bind path="userName"]
						<input id="${status.expression}" name="${status.expression}" value="${status.value!}" type="text" class="form-control" placeholder="[@spring.message code="user.create.form.placeholder.userName"/]">
						[/@spring.bind]
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">[@spring.message code="user.create.form.label.parentName"/]</label>
				<div class="col-md-9">
					<div class="input-group">
						<div class="input-icon">
							<i class="fa fa-user fa-fw"></i>
							[@spring.bind path="parentName"]
							<input id="${status.expression}" name="${status.expression}" value="${status.value!}" type="text" class="form-control" placeholder="[@spring.message code="user.create.form.placeholder.parentName"/]">
							[/@spring.bind]
						</div>
						<span class="input-group-btn">
							<button id="selparent" class="btn btn-success" type="button"><i class="fa fa-user"></i></button>
						</span>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">[@spring.message code="user.create.form.label.accountType"/]</label>
				<div class="col-md-9">
					<div class="btn-group" data-toggle="buttons">
						[@spring.bind path="accountType"]
						[#list enums["net.lanelife.casino.caipiao.entity.User$AccountType"]?values as item]
						<label class="btn btn-default[#if item==status.value] active[/#if]">
							<input name="${status.expression}" value="${item.name()}" [#if item==status.value]checked="checked"[/#if] type="radio" class="toggle">
							[@spring.message code="net.lanelife.casino.caipiao.entity.User.AccountType."+item.name()/]
						</label>
						[/#list]
						[/@spring.bind]
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">[@spring.message code="user.create.form.label.loginPassword"/]</label>
				<div class="col-md-9">
					<div class="input-group">
						<div class="input-icon">
							<i class="fa fa-lock fa-fw"></i>
							[@spring.bind path="loginPassword"]
							<input id="${status.expression}" name="${status.expression}" value="${status.value!}" type="text" class="form-control" placeholder="[@spring.message code="user.create.form.placeholder.loginPassword"/]"/>
							[/@spring.bind]
						</div>
						<span class="input-group-btn">
							<button id="genpassword" class="btn btn-success" type="button"><i class="fa fa-arrow-left fa-fw"/></i>[@spring.message code="user.create.form.button.genPassword"/]</button>
						</span>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">[@spring.message code="user.create.form.label.layerId"/]</label>
				<div class="col-md-9">
					[@spring.bind path="layerId"]
					<select id="${status.expression}" name="${status.expression}" class="bs-select form-control">
						[#list userLayerList as item]
						<option value="${item.id}" [#if item.isDefault]selected="selected"[/#if] data-content="${item.name} [#if item.isDefault]<span class='label lable-sm label-success'>[@spring.message code="user.create.form.label.layer.default"/]</span>[/#if]">
							${item.name}
						</option>
						[/#list]
					</select>
					[/@spring.bind]
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">[@spring.message code="user.create.form.label.layerLocked"/]</label>
				<div class="col-md-9">
					<div class="btn-group" data-toggle="buttons">
						[@spring.bind path="layerLocked"]
						<label class="btn btn-default [#if status.value=="true"]active[/#if]">
							<input name="${status.expression}" value="true" [#if status.value=="true"]checked="checked"[/#if] type="radio" class="toggle">[@spring.message code="user.create.form.radio.layerLocked.TRUE"/]
						</label>
						<label class="btn btn-default [#if status.value=="false"]active[/#if]">
							<input name="${status.expression}" value="false" [#if status.value=="false"]checked="checked"[/#if] type="radio" class="toggle">[@spring.message code="user.create.form.radio.layerLocked.FALSE"/]
						</label>
						[/@spring.bind]
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-3 control-label">[@spring.message code="user.create.form.label.rebatePoint"/]</label>
				<div class="col-md-9">
					[@spring.bind path="rebatePoint"]
					<input id="${status.expression}" name="${status.expression}" type="text" value="${preference["rebate.point.min"]}"/>
					[/@spring.bind]
				</div>
			</div>
		</div>
	</div>
	<div class="modal-footer">
		<button type="button" class="btn default" data-dismiss="modal">[@spring.message code="form.button.close"/]</button>
		<button type="submit" class="btn blue">[@spring.message code="form.button.submit"/]</button>
	</div>
	[/@form.form]
</div>

<script type="text/javascript">

setTimeout(function(){
	$("#rebatePoint").ionRangeSlider({
	    type: "single",
	    step: 0.1,
	    min: ${preference["rebate.point.min"]},
	    max: ${preference["rebate.point.max"]},
	    from: ${preference["rebate.point.min"]},
	    hideMinMax: true
	});
},100)

$("#genpassword").click(function(){
	$("#loginPassword").val('a' + parseInt(Math.random() * (100000 - 999999 + 1) + 999999));
});


$('#createDTO').validate({
	rules: {
  	},
	messages:{
	}
});

</script>